<div>
    <fieldset id="AddUserField" style="padding-top: 1em;">
        <legend>Данные читателя</legend>

        <table>

            <tr><td></td><td class="ErrorMessage" data-field="log"></td></tr>

            <tr style="padding-top: 2em;">
                <td class="AlignRight"><label for="login">Логин:</label></td>
                <td><input class="Text" type="text" id="login"
                    value="<?php echo $this->NewLogin(); ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="login"></td></tr>

            <tr>
                <td class="AlignRight"><label for="pass">Пароль:</label></td>
                <td><input class="Text" type="text" id="pass"
                    value="<?php echo $this->NewPass(); ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="pass"></td></tr>

            <tr>
                <td class="AlignRight"><label for="fullname">ФИО:</label></td>
                <td><input class="Text" type="text" id="fullname"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="fullname"></td></tr>

            <tr>
                <td><label for="reg_date">Дата регистрации:</label></td>
                <td><input class="Text" type="text" id="reg_date"
                    value="<?php echo date('d.m.Y', time()); ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="reg_date"></td></tr>

            <tr>
                <td><label for="reg_comp">Дата окончания:</label></td>
                <td><input class="Text" type="text" id="reg_comp"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="reg_comp"></td></tr>

        </table>

    </fieldset>

    <div class="ControlPanel">
        <button id="AddReaderBtn">Создать</button>
        <button id="CancelBtn">Отмена</button>
    </div>

    <script type="text/javascript">
        jsun.run(function() {
        //////////////////////////////////////////////////////

        jsun("#AddReaderBtn").jsun.event({ onclick: AddReader });
        jsun("#CancelBtn").jsun.event({ onclick: CancelAdd });

        function AddReader() {
            var param = "u=Lib/AddReader" + jsun.page.get_data();

            jsun.json.load(function(p) {
                if (p.STAT != 'ERR') {
                    window.location.reload();
                } else {
                    jsun.show_err(p);
                }
            }, param);
        }

        function CancelAdd() {
            return jsun.dialog.active.close();
        }

        ///////////////////////////////////////////////////////
        });
    </script>
</div>